package com.sumer.psychology.common.persistence.mongodb;

import com.mongodb.DBObject;

/**
 * 接受事件对象的mongo存储
 * <p/>
 * User: zhenguang.zhu
 * Date: 2014/10/24
 * Time: 15:06
 */
public class MongoEventUtil {
    /**
     * 过滤事件对象
     *
     * @param originalObject original Object
     * @return db object
     */
    public static DBObject filterEventObject(DBObject originalObject) {
        DBObject eventObject = (DBObject) originalObject.get("event");
        if (eventObject == null) {
            return originalObject;
        }
        eventObject.removeField("eventVersion");
        eventObject.removeField("occurredOn");

        return eventObject;
    }
}
